package main

import "fmt"

// cosnt 来定义枚举类型
const (
	//可以在const() 添加关键字，每行的iota都会累加1，第一行iota的默认值为0
	BEIJING  = iota // iota = 0
	SHANGHAI        // iota = 1
	SHENZHEN        // iota = 2
)

const (
	//可以在const() 添加关键字，每行的iota都会累加1，第一行iota的默认值为0
	BEIJING1  = 10 * iota // iota = 0; 10 * 0 = 0; BEIJING1 = 0
	SHANGHAI1             // iota = 1; 10 * 1 = 10; SHANGHAI1 = 10
	SHENZHEN1             // iota = 2; 10 * 2 = 20; SHENZHEN1 = 20
)

const (
	a,b = iota + 1, iota + 2 // iota = 0; a = iota + 1, b = iota + 2; a = 1,b = 2
	c, d  				     // iota = 1; c = iota + 1, d = iota + 2; c = 2,b = 3
	e, f  				     // iota = 2; e = iota + 1, f = iota + 2; e = 3,b = 4

	g, h = iota *2, iota * 3 // iota = 3; g = iota * 2, h = iota * 3; g = 6, h = 9
	i, k					 // iota = 4; i = iota *2, k = iota * 3; i = 8, k = 12
)

func main() {
	// 常量（只读属性）
	const lenght int = 10

	fmt.Println("lenght = ", lenght)
	fmt.Println("BEIJING = ", BEIJING)

	fmt.Println("BEIJING1 = ", BEIJING1)
	fmt.Println("SHANGHAI1 = ", SHANGHAI1)
	fmt.Println("SHENZHEN1 = ", SHENZHEN1)


	fmt.Println("a = ", a, " b = ", b)
	fmt.Println("c = ", c, " d = ", d)
	fmt.Println("e = ", e, " f = ", f)
	fmt.Println("g = ", g, " h = ", h)
	fmt.Println("i = ", i, " k = ", k)
}
